# 谷歌无GUI浏览器执行
import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

CHROME_OPTIONS = Options()
CHROME_OPTIONS.add_argument('--headless')
CHROME_OPTIONS.add_argument('--disable-gpu')
CHROME_BROWSER_PATH = r'C:\Program Files\Google\Chrome\Application\chrome.exe'
CHROME_OPTIONS.binary_location = CHROME_BROWSER_PATH
BROWSER = webdriver.Chrome(chrome_options=CHROME_OPTIONS)

TARGET_URL = 'https://www.baidu.com/'
BROWSER.get(TARGET_URL)

BROWSER.save_screenshot("快照.png")
